USE Curriculum
IF	EXISTS (
		SELECT	name 
		FROM	sysobjects
		WHERE	name = 'CandidateVacancyDChangeDate' AND type = 'TR')
	DROP TRIGGER CandidateVacancyDChangeDate
GO
CREATE TRIGGER CandidateVacancyDChangeDate
ON CandidateVacancy
AFTER DELETE
AS
	Declare @MyId int
	select	@MyId = CandidateId
	from	deleted
	
	update	Candidate
	set		ChangeDate = GetDate()
	where	CandidateId = @MyId		
GO
